
<h1><?php echo $this->getActionLabel() ?></h1>
<div class="form">
<?php Yii::app()->clientScript->registerCoreScript('jquery'); ?>
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'adminhtml-admin-form',
	//'enableAjaxValidation'=>false,
)); /* @var $form CActiveForm */?>

	<p class="note">标识 <span class="required">*</span> 为必填项.</p>

	<?php echo Yii::app()->admin->showPutMsg(); ?>
	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'username'); ?>
		<?php echo $form->textField($model,'username',array('size'=>20,'maxlength'=>64)); ?>
		<?php echo $form->error($model,'username'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'nickname'); ?>
		<?php echo $form->textField($model,'nickname',array('size'=>20,'maxlength'=>50)); ?>
		<?php echo $form->error($model,'nickname'); ?>
	</div>

	<div class="row" style="display:none;">
		<?php echo $form->labelEx($model,'password_cr'); ?>
		<input type="password" id="AdminhtmlAdmin_password_cr" name="AdminhtmlAdmin[password_cr]" maxlength="64" size="32" autocomplete="off">
		<?php echo $form->error($model,'password_cr'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'password'); ?>
		<?php echo $form->passwordField($model,'password',array('size'=>32, 'maxlength'=>64, 'disabled'=>true, 'autocomplete'=>'off')); ?>
		<span style="margin-left:5px"><input type="checkbox" id="chg_password" /> 修改密码</span><br/>
		<?php echo $form->error($model,'password'); ?>
	</div>

	<div class="row" style="display:none;">
		<?php echo $form->labelEx($model,'password_cf'); ?>
		<input type="password" id="AdminhtmlAdmin_password_cf" name="AdminhtmlAdmin[password_cf]" maxlength="64" size="32" autocomplete="off">
		<?php echo $form->error($model,'password_cf'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'email'); ?>
		<?php echo $form->textField($model,'email',array('size'=>32,'maxlength'=>32)); ?>
		<?php echo $form->error($model,'email'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'create_time'); ?>
		<?php echo $form->textField($model,'create_time', array('disabled'=>true,)); ?>
		<?php echo $form->error($model,'create_time'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'update_time'); ?>
		<?php echo $form->textField($model,'update_time', array('disabled'=>true,)); ?>
		<?php echo $form->error($model,'update_time'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'remark'); ?>
		<?php echo $form->textArea($model,'remark',array('rows'=>3, 'cols'=>50)); ?>
		<?php echo $form->error($model,'remark'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton('保存'); ?>
	</div>

<?php $this->endWidget(); ?>
<script type="text/javascript">
$('#chg_password').change(function(){
	if(this.checked==true){
		$('#AdminhtmlAdmin_password_cr').parent().show();
		$('#AdminhtmlAdmin_password_cf').parent().show();
		$('#AdminhtmlAdmin_password').attr('disabled',false);
		$('#AdminhtmlAdmin_password').val('');
		
	} else {
		$('#AdminhtmlAdmin_password_cr').parent().hide();
		$('#AdminhtmlAdmin_password_cf').parent().hide();
		$('#AdminhtmlAdmin_password').val('******');
		$('#AdminhtmlAdmin_password').attr('disabled',true);
	}
});
$('input[type=password]').blur(function(){
	if( $('#AdminhtmlAdmin_password').val() && $('#AdminhtmlAdmin_password_cf').val()
	  && $('#AdminhtmlAdmin_password').val()!=$('#AdminhtmlAdmin_password_cf').val() 
	){
		$('#AdminhtmlAdmin_password').addClass('error');
		$('#AdminhtmlAdmin_password_cf').addClass('error');
		$('input[type=submit]').each(function(){this.disabled= true;});
		alert('两次输入的密码不对应');
	} else {
		$('#AdminhtmlAdmin_password').removeClass('error');
		$('#AdminhtmlAdmin_password_cf').removeClass('error');
		$('input[type=submit]').each(function(){this.disabled= false;});
	}
});
</script>
</div><!-- form -->